package com.lagou.work.task03.angel.jobService.impl.test;

import com.lagou.work.task03.angel.utils.DateUtils;
import com.lagou.work.task03.angel.utils.IOUtil;
import com.lagou.work.task03.angel.utils.ParsePropertiesFileUtil;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

/**
 * @author：dingyuan
 * @date：Created in 2022/3/27 21:51
 * @description：测试类
 * @version: 1.0
 */
public class test {
    public static void main(String[] args) throws IOException {
   /*     JobServiceImpl jobService = new JobServiceImpl();
        jobService.getJobManageMaster(8886);*/

/*        Map<String, String> configMap = new ParsePropertiesFileUtil().readProperties("angle/master-sit.properties");
        ArrayList<Map<String, String>> mapList = new ArrayList<>();

        LinkedHashSet<String> linkedHashSet = new LinkedHashSet();

        for (String s : configMap.keySet()) {
            linkedHashSet.add(s.split("\\.")[0]);
        }
        for (String set : linkedHashSet) {
            HashMap<String, String> map = new HashMap<>();
            for (String s : configMap.keySet()) {
                if(s.contains(set)) {
                    map.put(s.contains("host") ? "server.host" : "server.port", configMap.get(s));
                }
            }
            mapList.add(map);
        }
        System.out.println(configMap);*/

/*        String strings = IOUtil.readFileFromLocal("D://test.txt");

        IOUtil.writeFile2Local("D://test1.txt",strings);
        System.out.println(strings);*/
 /*       BubbleSort bubbleSort = new BubbleSort();
        String sort = bubbleSort.sort("1\t2\t3\t12\t88");
        System.out.println(sort);*/

/*        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
        String format = sdf.format(date);
        BubbleSort bubbleSort = new BubbleSort();
        String invoke = bubbleSort.sort("1\t2\t3\t12\t88");
        IOUtil.writeFile2Local("D://out/test1_"+format+".txt",invoke);*/
        Map<String, String> stringStringMap = new ParsePropertiesFileUtil().readProperties("angle/server-sit.properties");

        // 将排序结果输出到指定目录路径下（指定的目录通过配置文件server-sit.properties设置），输出的文件名需自定义
        String time = DateUtils.date2StrByFormatParam(new Date(),"yyyyMMddHHmmss");

        String out2Path = stringStringMap.get("outPath");
        String outPutPath = out2Path +"sortResult_" + time + ".txt";
        System.out.println(outPutPath);

    }
}
